package com.irdstudio.apicenter.gateway.web.view;


import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.irdstudio.apicenter.gateway.comm.MaccsPacket;
/**
 * 用于转发JSON的视图
 * 直接将转发过程中接收到的JSON字符串原样转发给客户端
 * @author guangming.li
 * @version 1.0
 * @date 2015-05-27
 */
public class ForwardJsonView extends AbstractView {
	private static final Logger log = LoggerFactory
			.getLogger(ForwardJsonView.class);
	public ForwardJsonView(HttpServletRequest request,HttpServletResponse response, MaccsPacket packet) {
		super(request,response, packet);
	 
	}

	public void renderView() {
		try {
			response.setContentType("text/html;charset=UTF-8");
			response.getWriter().write(packet.getMap().toString());
			log.debug("Result:" + packet.toString());
		} catch (Exception e) {
			log.error("error:", e);
		}
	}

	@Override
	public String getViewData() {
		return "";
	}

	@Override
	public Map<String, Object> getMapData() {
		// TODO Auto-generated method stub
		return null;
	}
}

